#include "setClueCardPositionMessage.h"
#include "jsonUtils.h"

SetClueCardPositionMessage::SetClueCardPositionMessage(MtpProtocol* packet) : MtpMessage(packet),position(0)
{
}

SetClueCardPositionMessage::SetClueCardPositionMessage(const int64_t& clueCardId, const int& channel, const int& position)
	: MtpMessage(new MtpProtocol(L"setClueCardPosition")),param(clueCardId,channel),position(position)
{

}

void SetClueCardPositionMessage::decodeBody()
{
	MtpMessage::decodeBody();
	JsonDoc& doc = param.jsonDeserialize(jsonContent);
	JsonUtils::loadInt(doc, L"position", position);
}

void SetClueCardPositionMessage::encodeBody()
{
	JsonDoc& doc = param.jsonSerialize();
	doc.AddMember(L"position", position, doc.GetAllocator());
	jsonContent = JsonUtils::jsonStr(doc);
	MtpMessage::encodeBody();
}

const ClueCardParam& SetClueCardPositionMessage::getParam() const
{
	return param;
}

const int& SetClueCardPositionMessage::getPosition() const
{
	return position;
}
